@echo off
setlocal
:: constants

:: bootstrap
pushd %~dp0
call _configure.bat
popd

set PHP_COMPACT_FILE_SCRIPT=%TOOLS_DIR%minifier\compact_files.php
set JS_SOURCE_LIST_FILE=%BRANCH_HOSTING_PATH%\js-list.txt
set JS_SOURCE_PATH=%BRANCH_HOSTING_PATH%\src
set JS_COMPACT_TEMP_FILE=%TEMP%\js-compact-cache.js
set JS_MINIFY_OUTPUT_FILE=%BRANCH_HOSTING_PATH%\release\minified.js

:: java -jar yuicompressor-x.y.z.jar [options] [input file]
set YUI_CALL=java -jar %YUI_COMPRESSOR_JAR%

:: start
pushd %JS_SOURCE_PATH%
call php "%PHP_COMPACT_FILE_SCRIPT%" "%JS_SOURCE_LIST_FILE%" "%JS_COMPACT_TEMP_FILE%"
popd

echo temp: %JS_COMPACT_TEMP_FILE%


call java -jar %YUI_COMPRESSOR_JAR% "%JS_COMPACT_TEMP_FILE%" -o "%JS_MINIFY_OUTPUT_FILE%"

del %JS_COMPACT_TEMP_FILE%


:end
endlocal